package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
<#if kotlin>
open class ${table.serviceImplName}  {

}
<#else>
public class ${table.serviceImplName}  implements ${table.serviceName} {
    @Resource
    private ${table.mapperName}  ${table.mapperName?uncap_first};

    /**
     * 之所以要生成以下方法而不直接用mybatis-plus的原始方法，是为了方便追溯某个mapper调用代码,
     * 避免find use后找出一批无关的代码
     */

    @Override
    public int insert(${entity} entity) {
        return ${table.mapperName?uncap_first}.insert(entity);
    }

    @Override
    public int deleteById(Serializable id) {
        return ${table.mapperName?uncap_first}.deleteById(id);
    }

    @Override
    public int deleteBatchIds(Collection<? extends Serializable> idList) {
        return ${table.mapperName?uncap_first}.deleteBatchIds(idList);
    }

    @Override
    public int updateById(${entity} entity) {
        return ${table.mapperName?uncap_first}.updateById(entity);
    }

    @Override
    public ${entity} selectById(Serializable id) {
        return ${table.mapperName?uncap_first}.selectById(id);
    }

    @Override
    public List<${entity}> selectBatchIds(Collection<? extends Serializable> idList) {
        return ${table.mapperName?uncap_first}.selectBatchIds(idList);
    }

/**------------以上是生成代码-----------------------------------------------------------------------------------------------------------------*/




}
</#if>
